package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppVoiceSignatureDao;
import com.vf.admin.client.service.AppVoiceSignatureService;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppAuth;
import com.vf.admin.miaodong.entity.AppVoiceSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Random;

@Service
public class AppVoiceSignatureServiceImpl implements AppVoiceSignatureService {

    @Autowired
    AppVoiceSignatureDao appVoiceSignatureDao;

    @Override
    public List<AppVoiceSignature> list() {
        return appVoiceSignatureDao.list();
    }

    @Override
    public AppVoiceSignature randomOne() {
        Random r = new Random();
        List<AppVoiceSignature> list = appVoiceSignatureDao.list();

        return list.get(r.nextInt(list.size()));
    }

    @Override
    public List<AppVoiceSignature> page(SplitPageBean splitPage) {
        return appVoiceSignatureDao.page(splitPage);
    }

    @Override
    public AppVoiceSignature get(Integer id) {
        return appVoiceSignatureDao.get(id, AppVoiceSignature.class);
    }

    @Override
    public void del(Integer id) {
        appVoiceSignatureDao.del(id);
    }

    @Override
    public void save(AppVoiceSignature param) {
        if (param.getId() != null && param.getId() > 0) {
            appVoiceSignatureDao.update(param);
        } else {
            appVoiceSignatureDao.add(param);
        }
    }
}
